package cn.wit.summit.chwan.adapters;

import android.app.Activity;

import java.util.List;

import cn.wit.summit.chwan.R;
import cn.wit.summit.chwan.models.dto.ViewBean;
import cn.wit.summit.chwan.widgets.skeleton.SkeletonAdapter;

/**
 * Created by Alan on 2018/4/4.
 */

public class RecommendSkeletonAdapter extends SkeletonAdapter {

    private List<ViewBean> mDatas;
    private Activity mContext;

    public RecommendSkeletonAdapter(Activity context, List<ViewBean> datas) {
        this.mContext = context;
        this.mDatas = datas;
    }

    @Override
    public int getLayoutResId(int viewType) {
        if (viewType == RecommendAdapter.ViewType.TYPE_PAST_IMAGE.ordinal()) {
            return R.layout.item_recommend_past_image_skeleton_view;
        } else if (viewType == RecommendAdapter.ViewType.TYPE_NEW_GAME.ordinal()) {
            return R.layout.item_recommend_new_game_skeleton_view;
        } else if (viewType == RecommendAdapter.ViewType.TYPE_BEST_MONTH.ordinal()) {
            return R.layout.item_recommend_best_month_skeleton_view;
        }
        return super.getLayoutResId(viewType);
    }

    @Override
    public int getItemViewType(int position) {
        if (mDatas == null) return 0;
        return mDatas.get(position).getViewType();
    }

    @Override
    public int getItemCount() {
        if (mDatas == null) return 0;
        return mDatas.size();
    }
}
